package com.czl.module_service.adapter;

import androidx.annotation.NonNull;

import com.blankj.utilcode.util.TimeUtils;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder;
import com.czl.base.data.bean.tengyun.NoticeListBean;
import com.czl.module_service.databinding.ItemNoticeListBinding;

import java.util.Date;

public class NoticeListAdapter extends BaseQuickAdapter<NoticeListBean.Data, BaseDataBindingHolder<ItemNoticeListBinding>> {
    public NoticeListAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(@NonNull BaseDataBindingHolder<ItemNoticeListBinding> itemNoticeBindingBaseDataBindingHolder, NoticeListBean.Data data) {
        System.out.println("111111");
        ItemNoticeListBinding viewBinding = itemNoticeBindingBaseDataBindingHolder.getDataBinding();
        viewBinding.tvTitle.setText(data.getAnnouncementTitle());
        viewBinding.tvJianjie.setText(data.getAnnouncementIntroduction());
        Glide.with(getContext())
                .load(data.getCoverImage())
                .apply(new RequestOptions().override(Target.SIZE_ORIGINAL))
                .into(viewBinding.ivPic);
        viewBinding.tvCreateTime.setText(TimeUtils.date2String(
                new Date(data.getReleaseTime()),
                "yyyy-MM-dd HH:mm"
        ));
    }

}
